const fs=require("fs");
const readFile=fs.createReadStream('from.txt','utf-8');
const writeFile=fs.createWriteStream('to.txt');


readFile.on('data',(chunk)=>{
    writeFile.write(chunk.toUpperCase());
})
readFile.on('end',()=>{
    writeFile.end();
    console.log("已经将from的字母转成大写并写入到to");

})
readFile.on('error',(err)=>{
    console.log("错误")
})
writeFile.on('error',(err)=>{
    console.log("错误")
})